package com.higgins.eventtracking.server.dataModel;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.higgins.eventtracking.client.dto.HealthAlertDTO;
import com.higgins.eventtracking.client.dto.HealthEventDTO;

@PersistenceCapable
public class HealthAlert {
	@SuppressWarnings("unused")
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;
		
	@Persistent
	private String name;
	
	@Persistent
	private Integer every;
	
	@Persistent
	private String timePeriod;
	
	@Persistent
	private Double hourOfAlert;
	
	@Persistent
	private String eventType;
	
	@Persistent
	private String eventName;
	
	@Persistent
	private String consumptionEvent;
	
	@Persistent
	private String trackingEvent;

	@Persistent
	private String healthEvent;

	@Persistent
	private String tab;
	
	@Persistent
	private Integer column;
	
	@Persistent
	private Integer row;
	
	@Persistent
	private Boolean count;
	
	@Persistent
	private Boolean onOff;
	
	public HealthAlert()	{

	}
	public HealthAlert(HealthAlertDTO dto)	{
		this.name = dto.getName();
		this.every = dto.getEvery();
		this.timePeriod = dto.getTimePeriod();
		this.hourOfAlert = dto.getHourOfAlert();
		this.eventType = dto.getEventType();
		this.eventName = dto.getEventName();
		this.consumptionEvent = dto.getConsumptionEvent();
		this.trackingEvent = dto.getTrackingEvent();
		this.healthEvent = dto.getHealthEvent();
		this.tab = dto.getTab();
		this.column = dto.getColumn();
		this.row = dto.getRow();
		this.count = dto.getCount();
		this.onOff = dto.getOnOff();
	}
	public Long getId()	{
		return id;
	}
	public void setName(String name)	{
		this.name = name;
	}
	public String getName()	{
		return name;
	}
	public void setEvery(Integer every)	{
		this.every = every;
	}
	public Integer getEvery()	{
		return every;
	}
	public void setTimePeriod(String timePeriod)	{
		this.timePeriod = timePeriod;
	}
	public String getTimePeriod()	{
		return timePeriod;
	}
	public void setHourOfAlert(Double hourOfAlert)	{
		this.hourOfAlert = hourOfAlert;
	}
	public Double getHourOfAlert()	{
		return hourOfAlert;
	}
	public void setEventType(String eventType)	{
		this.eventType = eventType;
	}
	public String getEventType()	{
		return eventType;
	}
	public void setEventName(String eventName)	{
		this.eventName = eventName;
	}
	public String getEventName()	{
		return eventName;
	}
	public void setConsumptionEvent(String consumptionEvent)	{
		this.consumptionEvent = consumptionEvent;
	}
	public String getConsumptionEvent()	{
		return consumptionEvent;
	}
	public void setTrackingEvent(String trackingEvent)	{
		this.trackingEvent = trackingEvent;
	}
	public String getTrackingEvent()	{
		return trackingEvent;
	}
	public void setHealthEvent(String healthEvent)	{
		this.healthEvent = healthEvent;
	}
	public String getHealthEvent()	{
		return healthEvent;
	}
	public void setTab(String tab)	{
		this.tab = tab;
	}
	public String getTab()	{
		return tab;
	}
	public void setColumn(Integer column)	{
		this.column = column;
	}
	public Integer getColumn()	{
		return column;
	}
	public void setRow(Integer row)	{
		this.row = row;
	}
	public Integer getRow()	{
		return row;
	}
	public void setCount(Boolean count)	{
		this.count = count;
	}
	public Boolean getCount()	{
		return count;
	}
	public void setOnOff(Boolean onOff)	{
		this.onOff = onOff;
	}
	public Boolean getOnOff()	{
		return onOff;
	}
	public HealthAlertDTO toDTO()	{
		HealthAlertDTO dto = new HealthAlertDTO(id, name, every, timePeriod, hourOfAlert, eventType, eventName, consumptionEvent, 
												trackingEvent, healthEvent, tab, column, row, count, onOff);
		return dto;
	}
	public void update(HealthAlertDTO dto)	{
		this.name = dto.getName();
		this.every = dto.getEvery();
		this.timePeriod = dto.getTimePeriod();
		this.hourOfAlert = dto.getHourOfAlert();
		this.eventType = dto.getEventType();
		this.eventName = dto.getEventName();
		this.consumptionEvent = dto.getConsumptionEvent();
		this.trackingEvent = dto.getTrackingEvent();
		this.healthEvent = dto.getHealthEvent();
		this.tab = dto.getTab();
		this.column = dto.getColumn();
		this.row = dto.getRow();
		this.count = dto.getCount();
		this.onOff = dto.getOnOff();
	}
}
